import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import '../../../app_files.dart';
import 'action.dart';
import 'state.dart';

Widget buildView(
    OrderTransferViewState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    appBar: myAppBar(viewService.context, title: '转单'),
    backgroundColor: Colors.white,
    body: GestureDetector(
      onTap: () => CommonUtils.closeKey(viewService.context),
      behavior: HitTestBehavior.translucent,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          // Container(
          //   padding: EdgeInsets.only(left: 12, right: 12, bottom: 4),
          //   child: Column(
          //     crossAxisAlignment: CrossAxisAlignment.start,
          //     children: [
          //       Container(
          //         height: 44,
          //         child: Align(
          //           alignment: Alignment.centerLeft,
          //           child: Text(
          //             '接单工作人员',
          //             style: TextThemeConfig.Font16WithColorBold22,
          //           ),
          //         ),
          //       ),
          //       Container(
          //         padding: EdgeInsets.only(bottom: 8),
          //         decoration: BoxDecoration(
          //             border: Border(
          //                 bottom: BorderSide(
          //                     color: ThemeConfig.separeColor, width: 1))),
          //         child: MyInkWellWidget(
          //           child: Row(
          //             crossAxisAlignment: CrossAxisAlignment.start,
          //             children: [
          //               Expanded(
          //                 child: state.selectWorker != null
          //                     ? Text(state.selectWorker.userName,
          //                         style: TextThemeConfig.Font14WithColor22)
          //                     : Text(
          //                         '请选择',
          //                         style: TextThemeConfig.Font14WithColor66,
          //                       ),
          //               ),
          //               Image.asset('images/right_arrow.png'),
          //             ],
          //           ),
          //           onTap: () async {
          //             var res = await CommonUtils.pushRoute(
          //                 viewService.context, RoutePath.fixWorkerListView,
          //                 arguments: {'worker': state.selectWorker});
          //             state.selectWorker = res;
          //             dispatch(OrderTransferViewActionCreator.onAction());
          //           },
          //         ),
          //       ),
          //     ],
          //   ),
          // ),
          Container(
            margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
            padding: EdgeInsets.all(15),
            width: double.infinity,
            height: 175,
            decoration: BoxDecoration(
              color: Color(0xfff2f2f2),
              borderRadius: BorderRadius.all(Radius.circular(4)),
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  '转单原因',
                  style: TextThemeConfig.Font15WithColor22,
                ),
                Expanded(
                  child: Container(
                    child: TextField(
                      minLines: 1,
                      maxLines: 10,
                      controller: state.contentController,
                      style: TextThemeConfig.Font13WithColor22,
                      decoration: InputDecoration(
                        border: InputBorder.none,
                        hintText: "请输入转单原因",
                        hintStyle: TextThemeConfig.Font13WithColor99,
                        contentPadding: EdgeInsets.only(),
                      ),
                      onChanged: (String str) {
                        if (str.length > ThemeConfig.descTextLength)
                          state.contentController.text =
                              str.substring(0, ThemeConfig.descTextLength);
                      },
                    ),
                  ),
                ),
              ],
            ),
          ),
          Expanded(
            child: Container(
              child: Column(
                children: [
                  Container(
                    height: 50,
                    margin: EdgeInsets.only(left: 15, right: 15, top: 30),
                    decoration: BoxDecoration(
                      color: ThemeConfig.mainColor,
                      borderRadius: BorderRadius.all(Radius.circular(4)),
                    ),
                    child: InkWell(
                      child: Center(
                        child: Text(
                          '提交',
                          style: TextThemeConfig.Font16WithWhite,
                        ),
                      ),
                      onTap: () =>
                          dispatch(OrderTransferViewActionCreator.onSubmit()),
                    ),
                  )
                ],
              ),
            ),
          ),
        ],
      ),
    ),
  );
}
